/**
 */
package de.thwildau.tm.moses.asn1.asn1.impl;

import de.thwildau.tm.moses.asn1.asn1.AlternativeTypeList;
import de.thwildau.tm.moses.asn1.asn1.Asn1Package;
import de.thwildau.tm.moses.asn1.asn1.ExtensionAdditionAlternativesGroup;
import de.thwildau.tm.moses.asn1.asn1.VersionNumber;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Extension Addition Alternatives Group</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.thwildau.tm.moses.asn1.asn1.impl.ExtensionAdditionAlternativesGroupImpl#getVersionNumber <em>Version Number</em>}</li>
 *   <li>{@link de.thwildau.tm.moses.asn1.asn1.impl.ExtensionAdditionAlternativesGroupImpl#getAlternativeTypeList <em>Alternative Type List</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ExtensionAdditionAlternativesGroupImpl extends ExtensionAdditionAlternativeImpl implements ExtensionAdditionAlternativesGroup
{
  /**
   * The cached value of the '{@link #getVersionNumber() <em>Version Number</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVersionNumber()
   * @generated
   * @ordered
   */
  protected VersionNumber versionNumber;

  /**
   * The cached value of the '{@link #getAlternativeTypeList() <em>Alternative Type List</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAlternativeTypeList()
   * @generated
   * @ordered
   */
  protected AlternativeTypeList alternativeTypeList;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ExtensionAdditionAlternativesGroupImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Asn1Package.Literals.EXTENSION_ADDITION_ALTERNATIVES_GROUP;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public VersionNumber getVersionNumber()
  {
    return versionNumber;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetVersionNumber(VersionNumber newVersionNumber, NotificationChain msgs)
  {
    VersionNumber oldVersionNumber = versionNumber;
    versionNumber = newVersionNumber;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER, oldVersionNumber, newVersionNumber);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setVersionNumber(VersionNumber newVersionNumber)
  {
    if (newVersionNumber != versionNumber)
    {
      NotificationChain msgs = null;
      if (versionNumber != null)
        msgs = ((InternalEObject)versionNumber).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER, null, msgs);
      if (newVersionNumber != null)
        msgs = ((InternalEObject)newVersionNumber).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER, null, msgs);
      msgs = basicSetVersionNumber(newVersionNumber, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER, newVersionNumber, newVersionNumber));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public AlternativeTypeList getAlternativeTypeList()
  {
    return alternativeTypeList;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAlternativeTypeList(AlternativeTypeList newAlternativeTypeList, NotificationChain msgs)
  {
    AlternativeTypeList oldAlternativeTypeList = alternativeTypeList;
    alternativeTypeList = newAlternativeTypeList;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST, oldAlternativeTypeList, newAlternativeTypeList);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAlternativeTypeList(AlternativeTypeList newAlternativeTypeList)
  {
    if (newAlternativeTypeList != alternativeTypeList)
    {
      NotificationChain msgs = null;
      if (alternativeTypeList != null)
        msgs = ((InternalEObject)alternativeTypeList).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST, null, msgs);
      if (newAlternativeTypeList != null)
        msgs = ((InternalEObject)newAlternativeTypeList).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST, null, msgs);
      msgs = basicSetAlternativeTypeList(newAlternativeTypeList, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST, newAlternativeTypeList, newAlternativeTypeList));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER:
        return basicSetVersionNumber(null, msgs);
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST:
        return basicSetAlternativeTypeList(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER:
        return getVersionNumber();
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST:
        return getAlternativeTypeList();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER:
        setVersionNumber((VersionNumber)newValue);
        return;
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST:
        setAlternativeTypeList((AlternativeTypeList)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER:
        setVersionNumber((VersionNumber)null);
        return;
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST:
        setAlternativeTypeList((AlternativeTypeList)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__VERSION_NUMBER:
        return versionNumber != null;
      case Asn1Package.EXTENSION_ADDITION_ALTERNATIVES_GROUP__ALTERNATIVE_TYPE_LIST:
        return alternativeTypeList != null;
    }
    return super.eIsSet(featureID);
  }

} //ExtensionAdditionAlternativesGroupImpl
